<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>风味-发表评论</title>
		<link rel="stylesheet" type="text/css" href="css/personCenterPublic.css"/>
		<script src="js/jquery-2.1.0.js"></script>
		<style type="text/css">
			#submit{width:100%;height: 50px;border: none;background: #d1d1d1;color: white;font-size: 18px;letter-spacing: 5px;
			position: fixed;bottom: 0;}
			textarea{width: 96%;resize: none;margin-top: 30px;position: absolute; left: 2%;}
			p{color: gray;font-size: 14px;margin-top: 20px;}
		</style>
	</head>
	<body>
		<div id="back">
			<a href="express.html"><&nbsp;返回我的快递</a>
		</div>
		<div id="commentcon">
			<p>请提交您对卖家或者您购买的特产的评价，如果放弃本次评论，则视这次评论作废。</p>
			<textarea name="ccomment" id="comment" rows="20" wrap="soft" placeholder="请输入您对此特产或者卖家的评价" maxlength="120"></textarea>
		</div>
		<input type="button" name="submit" id="submit" value="提交" />
		
		<script type="text/javascript">

			function getUrl(){
				var str = location.href;//获取传过来的地址
				var arr = str.split("?");
				var str1 = arr[1];//获取？之后的内容
				var id = str1.split("=")[1];
				return id;
			}

			var submitbutton=document.getElementById('submit');
			var textareacon=document.getElementsByTagName('textarea')[0];
			textareacon.oninput=function(){
				if(textareacon.value!=''){
					submitbutton.style.background='#FFCC33';
				}else 					submitbutton.style.background='#D1D1D1';
			};

			$("#submit").click(function(){
				var comment = $('#comment').val();
				$.ajax("/fengwei/comment/addComment",{
					type:"post",
					data:{
						'goodsorderId':getUrl(),
						'commentComments':comment
					},
					success:function(data){

						console.log(data);

					},
					error:function(){
						console.log(0);
					}
				});
			})

		</script>
	</body>
</html>
